package com.example.base.url.mvvm

import androidx.lifecycle.ViewModel
import com.example.base.url.ApiService
import com.example.base.url.RetrofitUtils
import com.google.gson.Gson
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody

open class BaseViewModel :ViewModel() {
    val apiService = RetrofitUtils.getRetrofit().create(ApiService::class.java)

    fun mapbody(map: Map<String,Any>):RequestBody{
        val toJson = Gson().toJson(map)
        val body = RequestBody.create("application/json;charset=utf-8".toMediaType(), toJson)
        return body
    }
}